<ui:composition template="/admin/templates/ui2.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:composite="http://java.sun.com/jsf/composite/primefaces"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
	<f:metadata>
		<f:viewParam name="id" value="#{foodHome.id}" ></f:viewParam>
	</f:metadata>
	<ui:define name="content">
	<style>
.ui-orderlist .ui-orderlist-list {
	height: auto;
	width: auto;
}

.col-img-prop {
	width: 318px;
}

.col-img {
	padding-left: 5px;
}
</style>
		<div class="entry">
			<p:toolbar styleClass="admin-nav-toolbar">
				<p:toolbarGroup>
					<h:outputLabel
						value="#{commonMsg.currentPositionLabel} 加个菜"></h:outputLabel>
				</p:toolbarGroup>
				<p:toolbarGroup align="right">
					<p:separator />
					<p:button outcome="/admin/order/foodList"
						value="看看都有啥菜"></p:button> 
				</p:toolbarGroup>
			</p:toolbar>
			<p:spacer></p:spacer>
			<h:form id="form" enctype="multipart/form-data">
				<h:panelGrid columns="2" styleClass="col1,col2" id="panel">

					<h:outputLabel value="菜的编号（拼音全拼就行）"></h:outputLabel>
					<h:inputText label="菜的编号（拼音全拼就行）" 
						value="#{foodHome.instance.id}" maxlength="100">
					</h:inputText>
						
					<h:outputLabel value="蔡明"></h:outputLabel>
					<h:inputText label="菜的编号（拼音全拼就行）" required="true"
						value="#{foodHome.instance.name}" maxlength="100">
					</h:inputText>
					
					
					<h:outputLabel value="图片片"></h:outputLabel>
					<ui:fragment rendered="#{empty foodHome.instance.picture}">
						<p:commandButton id="uploadPicBtn" type="button"
								onclick="uploadDialog.show()" process="@none"
								value="添加"></p:commandButton>
					</ui:fragment>
					<ui:fragment rendered="#{not empty foodHome.instance.picture}">
						<img src="#{request.contextPath}#{foodHome.instance.picture}" width="100px" height="100px"></img>
						<p:commandButton id="changePicBtn" type="button"
								onclick="uploadDialog.show()" process="@none"
								value="修改"></p:commandButton>
					</ui:fragment>
					
					<h:outputLabel value="#{commonMsg.actionLabel}"></h:outputLabel>
					<ui:fragment>
						<h:inputHidden value="#{foodHome.instance.id}"></h:inputHidden>
						<p:commandButton id="saveBtn" action="#{foodHome.save}"
							ajax="false" value="#{commonMsg.saveLabel}"></p:commandButton>
						<p:commandButton type="reset" value="#{commonMsg.resetLabel}"></p:commandButton>
					</ui:fragment>
				</h:panelGrid>
				
				<p:dialog id="uploadDialog" header="#{commonMsg.uploadLabel}"
					widgetVar="uploadDialog" modal="true" width="720" height="460">
					<p:fileUpload cancelLabel="#{commonMsg.cancelLabel}"
						dragDropSupport="true"
						invalidFileMessage="#{commonMsg.invalidFileMessage}"
						invalidSizeMessage="#{commonMsg.invalidSizeMessage}"
						uploadLabel="呵呵哒"
						label="#{commonMsg.choiceLabel}" oncomplete="uploadDialog.hide();"
						fileUploadListener="#{foodHome.uploadFoodPicture}"
						multiple="true" mode="advanced" update="form"
						sizeLimit="10000000" allowTypes="/(\.|\/)(gif|jpe?g|png)$/" />
				</p:dialog>
				

			</h:form>
		</div>
	</ui:define>
</ui:composition>

